package com.cgq.pro.entity;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.cgq.base.entity.Base;
import com.cgq.utils.PropertiesUtil;

/**
 * 市区统计实体类
 * @author chenkaile
 *
 */
@Entity
@Table(name="fd_city")
public class CityStatistics extends Base {
	/**序号*/
	private String cid;
	/**编号*/
	private String num;
	/**开发公司*/
	private String company;
	/**物业类型*/
	private String type;
	/**户型*/
	private String houseType;
	/**户型面积*/
	private double houseArea;
	/**总建面*/
	private double totalArea;
	/**总套数*/
	private int totalTs;
	/**总楼栋数*/
	private int totalBuilding;
	/**已推盘面积*/
	private double ytpArea;
	/**已推盘套数*/
	private double ytpTs;
	/**已售面积*/
	private double ysArea;
	/**已售套数*/
	private int ysTs;
	/**行政区*/
	private Region regionId;
	/**销售均价*/
	private double averagePrice;
	/**楼盘描述*/
	private String description;
	/**经度*/
	private String lon;
	/**纬度*/
	private String lat;
	/**块状地块点集合*/
	private String points;
	/**备注图标名称*/
	private String markerName;
	
	@Column/**地块类型：1.点状地块 2.块状地块*/
	private String landType;
	/**楼盘状态**/
	@Column
	private int p_status;
	
	public int getP_status() {
		return p_status;
	}
	public void setP_status(int p_status) {
		this.p_status = p_status;
	}
	public String getLandType() {
		return landType;
	}
	public void setLandType(String landType) {
		this.landType = landType;
	}
	
	@Column
	public String getPoints() {
		return points;
	}
	public void setPoints(String points) {
		this.points = points;
	}
	
	@Id
	@Column(name="cid")
	public String getCid() {
		return cid;
	}
	public void setCid(String cid) {
		this.cid = cid;
	}
	@Column
	public String getNum() {
		return num;
	}
	public void setNum(String num) {
		this.num = num;
	}
	@Column(name="company")
	public String getCompany() {
		return company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	
	@Column(name="type")
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	
	@Column(name="housetype")
	public String getHouseType() {
		return houseType;
	}
	public void setHouseType(String houseType) {
		this.houseType = houseType;
	}
	
	@Column(name="housearea")
	public double getHouseArea() {
		return houseArea;
	}
	public void setHouseArea(double houseArea) {
		this.houseArea = houseArea;
	}
	
	@Column(name="totalarea")
	public double getTotalArea() {
		return totalArea;
	}
	public void setTotalArea(double totalArea) {
		this.totalArea = totalArea;
	}
	
	@Column(name="totalts")
	public int getTotalTs() {
		return totalTs;
	}
	public void setTotalTs(int totalTs) {
		this.totalTs = totalTs;
	}
	
	@Column(name="totalbuilding")
	public int getTotalBuilding() {
		return totalBuilding;
	}
	public void setTotalBuilding(int totalBuilding) {
		this.totalBuilding = totalBuilding;
	}
	
	@Column(name="ytparea")
	public double getYtpArea() {
		return ytpArea;
	}
	public void setYtpArea(double ytpArea) {
		this.ytpArea = ytpArea;
	}
	
	@Column(name="ytpts")
	public double getYtpTs() {
		return ytpTs;
	}
	public void setYtpTs(double ytpTs) {
		this.ytpTs = ytpTs;
	}
	
	@Column(name="ysarea")
	public double getYsArea() {
		return ysArea;
	}
	public void setYsArea(double ysArea) {
		this.ysArea = ysArea;
	}
	
	@Column(name="ysts")
	public int getYsTs() {
		return ysTs;
	}
	public void setYsTs(int ysTs) {
		this.ysTs = ysTs;
	}
	
	@ManyToOne
	@JoinColumn(name="regionid")
	public Region getRegionId() {
		return regionId;
	}
	public void setRegionId(Region regionId) {
		this.regionId = regionId;
	}
	
	@Column(name="averageprice")
	public double getAveragePrice() {
		return averagePrice;
	}
	public void setAveragePrice(double averagePrice) {
		this.averagePrice = averagePrice;
	}
	
	@Column(name="description")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Column(name="longitude")
	public String getLon() {
		return lon;
	}
	public void setLon(String lon) {
		this.lon = lon;
	}
	
	@Column(name="Latitude")
	public String getLat() {
		return lat;
	}
	public void setLat(String lat) {
		this.lat = lat;
	}
	
	@Column
	public String getMarkerName() {
		return markerName;
	}
	public void setMarkerName(String markerName) {
		this.markerName = markerName;
	}
	@Override
	public Map<String, Object> toMap() {
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("id", this.cid);
		map.put("num", this.num);
		map.put("name", this.name);
		map.put("company", this.company);
		map.put("regionname", this.regionId.getName());
		try {
			map.put("type",PropertiesUtil.readByKey("landUseType", "type."+ this.type));
		} catch (Exception e) {
			e.printStackTrace();
		}
		map.put("p_status", PropertiesUtil.getPStatusStr(this.p_status));
		map.put("housetype", this.houseType);
		map.put("housearea", this.houseArea);
		map.put("totalarea", this.totalArea);
		map.put("totalts", this.totalTs);
		map.put("totalbuilding", this.totalBuilding);
		map.put("ytparea", this.ytpArea);
		map.put("ytpts", this.ytpTs);
		map.put("ysarea", this.ysArea);
		map.put("ysts", this.ysTs);
		map.put("averageprice", this.averagePrice);
		map.put("remark", this.remark);
		return map;
	}
}
